import Vue from 'vue'
import VueRouter from "vue-router";
import Article from '@/views/Article'
import ArticleDetail from '@/views/ArticleDetail'
import Layout from '@/views/Layout'
import Like from '@/views/Like'
import User from '@/views/User'
import Collect from '@/views/Collect'




Vue.use(VueRouter)

const router = new VueRouter({
  routes: [
    {
      path: '/', //默认
      component: Layout, //首页
      redirect:'/article', //重定向默认
      //二级路由
      children: [{
        path: '/article',
        component:Article
      },
        {
          path: '/collect',
          component:Collect
        },
        {
          path: 'like',
          component:Like
        },
        {
          path: 'user',
          component:User
        }
        
      ]
    },
    {
      path: '/detail/:id',//动态路由 传参
      component:ArticleDetail //详情页
    }
  ]
})

export default router